<template>
  <div class="contentbox">
    <div v-if="attachmentsList && attachmentsList.length != 0" class="fujianList">
      <fujian @fuzhiFunc="setItemData" :fujianList="attachmentsList"></fujian>
    </div>
    <div v-if="itemData" class="fujianAnswer">
      <annex-opinions
        v-if="showBox"
        :ref="itemData.fileType"
        :file="itemData"
        :linkName="linkName"
        :projectId="projectId"
      ></annex-opinions>
    </div>
    <div v-if="!attachmentsList && attachmentsList.length == 0" class="no-data">暂无数据</div>
    <!-- <div class="annexHeadTit">附件列表</div>
      <el-tabs class="annexTabs" tab-position="left" v-model="annexTabs">
        <el-tab-pane v-for="(item, index) in attachmentsList" :label="item.fileName | handleSuffix" :key="item.id" :name="`annexOpinions${index}`">
          <annex-opinions :ref="item.fileType" :file="item" :linkName="linkName" :projectId="projectId" ></annex-opinions>
        </el-tab-pane>
    </el-tabs>-->
  </div>
</template>

<script>
import annexOpinions from "./annexSub/annexOpinions";
import fujian from "@/components/fujianListForThree";
export default {
  components: {
    annexOpinions,
    fujian
  },
  data() {
    return {
      annexTabs: `annexOpinions0`,
      itemData: null,
      showBox: false
    };
  },
  props: {
    attachmentsList: {
      type: Array,
      require: true,
      default: () => []
    },
    projectId: {
      type: Number,
      require: true
    },
    linkName: {
      type: String,
      require: true
    }
  },
  created() {},
  methods: {
    setItemData(data) {
      console.log(data);
      this.itemData = data;
      this.showBox = true;
      this.$forceUpdate();
    },
    exportAnnexOpinionByType(fileType) {
      if (this.$refs[fileType]) {
        this.$refs[fileType].getExport();
      }
    }
  }
};
</script>

<style lang="scss" scoped>
.contentbox {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  // -webkit-align-items: center;
  // align-items: center;
  .fujianList {
    width: 25%;
  }
  .fujianAnswer {
    width: 75%;
  }
}
</style>

